package eu.jpereira.trainings.designpatterns.structural.facade;

import static org.mockito.Mockito.mock;
import eu.jpereira.trainings.designpatterns.structural.facade.model.Book;
import eu.jpereira.trainings.designpatterns.structural.facade.model.Customer;
import eu.jpereira.trainings.designpatterns.structural.facade.model.DispatchReceipt;
import eu.jpereira.trainings.designpatterns.structural.facade.model.Order;
import eu.jpereira.trainings.designpatterns.structural.facade.service.BookDBService;
import eu.jpereira.trainings.designpatterns.structural.facade.service.CustomerDBService;
import eu.jpereira.trainings.designpatterns.structural.facade.service.CustomerNotificationService;
import eu.jpereira.trainings.designpatterns.structural.facade.service.OrderingService;
import eu.jpereira.trainings.designpatterns.structural.facade.service.WharehouseService;

public class DefaultBookStoreFacade implements BookstoreFacade
{

	CustomerDBService 	customerService;
	BookDBService		bookService;
	OrderingService		orderingService;
	WharehouseService	warehouseService;
	CustomerNotificationService customerNotificationService;
	
	@Override
	public void placeOrder(String customerId, String isbn)
	{
		Book dummyBook = bookService.findBookByISBN(isbn);
		Customer dummyCustomer = customerService.findCustomerById(customerId);
		Order dummyOrder = orderingService.createOrder(dummyCustomer, dummyBook);
		DispatchReceipt dummyDispatchReceipt = warehouseService.dispatch(dummyOrder);
		customerNotificationService.notifyClient(dummyDispatchReceipt);
	}

	public void setCustomerService(CustomerDBService customerService)
	{
		this.customerService = customerService;
	}

	public void setWarehouseService(WharehouseService warehouseService)
	{
		this.warehouseService=warehouseService;
	}

	public void setOrderingService(OrderingService orderingService)
	{
		this.orderingService = orderingService;
	}

	public void setBookService(BookDBService bookService)
	{
		this.bookService = bookService;
	}

	public void setCustomerNotificationService(CustomerNotificationService customerNotificationService)
	{
		this.customerNotificationService = customerNotificationService;
	}

}
